package com.myteam.fugaocrm.sqldb.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.myteam.fugaocrm.modle.FgCustomerCompany;

/**
 * 客户公司Mapper
 * @author BZX
 */
public interface FgCustomerCompanyMapper {
	/** 查询一个客户公司 */
	@Select("select * from fg_customer_company where customer_company_id = #{customerCompanyId}")
	public FgCustomerCompany selectOne(@Param("customerCompanyId") Integer customerCompanyId);
	
	/** 查询全部客户公司 */
	@Select("select * from fg_customer_company where is_delete = 0")
	public List<FgCustomerCompany> all();
	
	/** 删除一个客户公司 */
	@Select("update fg_customer_company set is_delete = 1 where customer_company_id = #{customerCompanyId}")
	public void deleteOne(@Param("customerCompanyId") Integer customerCompanyId);
	
	/** 新增一个客户公司 */
	@Select("insert into fg_customer_company("
			+ "customer_company_name,"
			+ "customer_company_adress,"
			+ "industry_name,"
			+ "created_date,"
			+ "modified_date,"
			+ "created_user,"
			+ "modified_user"
			+ ") values("
			+ "#{customerCompanyName},"
			+ "#{customerCompanyAdress},"
			+ "#{industryName},"
			+ "#{createdDate},"
			+ "#{modifiedDate},"
			+ "#{createdUser},"
			+ "#{modifiedUser}"
			+ ")")
	public void insert(Map<String, Object> params);
	
	/** 修改一个客户公司 */
	@Select("update fg_customer_company set "
			+ "customer_company_name=#{customerCompanyName},"
			+ "customer_company_adress=#{customerCompanyAdress},"
			+ "industry_name=#{industryName},"
			+ "modified_user=#{modifiedUser},"
			+ "modified_date=#{modifiedDate} "
			+ "where customer_company_id = #{customerCompanyId}")
	public void update(Map<String, Object> params);
	
	
}
